//  This product includes software developed by Denim Group, Ltd. (http://www.denimgroup.com/)
//  All use and distribution of the Denim Group developed software is subject to Version 2.0
//  of the Apache License (http://www.apache.org/licenses/LICENSE-2.0).

using System;
using System.Collections.Generic;
using System.Net;
using System.Text;

using Microsoft.TeamFoundation.Client;

namespace AppScan.DefectLogger
{
    class TFS : IDefectTrackingSystem
    {
         private TeamFoundationServer _conn;

		/// <summary>
		/// ctor
		/// </summary>
		public TFS()
		{ 
		}

		public object NativeConnection
		{
			get
			{
				return _conn;
			}
		}

        public TeamFoundationServer Conn
        {
            get
            {
                return (_conn);
            }
        }

		/// <summary>
		/// Log in to defect tracking system
		/// </summary>
		/// <param name="serverUrl"></param>
		/// <param name="userName"></param>
		/// <param name="password"></param>
		/// <param name="domain"></param>
		/// <param name="project"></param>
        public void Login(string serverUrl, string userName, string password, string domain, string project)
        {
            NetworkCredential account = new NetworkCredential(userName, password, domain);
            TeamFoundationServer retVal = new TeamFoundationServer(serverUrl, account);
            retVal.Authenticate();
            _conn = retVal;
        }
    }
}
